﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;

namespace GmailMetroNotifier.Client.Business
{
    /// <summary>
    /// Defines methods and properties for connecting to Gmail.
    /// </summary>
    public interface IGmailManager
    {
        /// <summary>
        /// The event raised when the authentication fails.
        /// </summary>
        event EventHandler<AuthenticationFailedEventArgs> AuthenticationFailed;

        /// <summary>
        /// The event raised when the authentication succeeds.
        /// </summary>
        event EventHandler<AuthenticationSucceededEventArgs> AuthenticationSucceeded;

        /// <summary>
        /// Gets the account status using the given credential, retrying three times by default.
        /// </summary>
        /// <param name="credential">The credential to be used for retrieving the account status.</param>
        /// <returns>The account status, or null if it cannot be retrieved.</returns>
        AccountStatus GetAccountStatus(NetworkCredential credential);

        /// <summary>
        /// Gets the account status using the given credential, retrying the specified times.
        /// </summary>
        /// <param name="credential">The credential to be used for retrieving the account status.</param>
        /// <param name="maxAuthenticationRetries">Max number of authentication retries if the initial attempt fails.</param>
        /// <returns>The account status, or null if it cannot be retrieved.</returns>
        AccountStatus GetAccountStatus(NetworkCredential credential, int maxAuthenticationRetries);
    }
}
